package com.naiterui.ehp.bs.emr.controller.inner;

import com.naiterui.ehp.bp.bo.ca.EmrSignBO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.emr.exception.ExceptionCodes;
import com.naiterui.ehp.bs.emr.service.IDrCaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 签名回调
 * @Author gongbaoqiang
 * @Date 2019/12/4 7:54 PM
 */
@Slf4j
@RestController
@Api(tags = SwaggerTag.INNER_API + SwaggerTag.MEDICAL_RECORD)
@RequestMapping("emr/inner/esign")
public class EmrInnerESignController {


    @Autowired
    private IDrCaseService drCaseService;

    @ApiOperation(value = "病历签名回调")
    @RequestMapping("sign/result")
    public ResponseVO<Void> signResult(@RequestBody EmrSignBO bo) throws BusinessException {
        log.info("签名回调成功：esignBO={}", bo.toString());
        drCaseService.updateSignInfo(bo);
        return PublicService.returnResponseVO(ExceptionCodes.SUCCESS);
    }

}
